package scjp.preparation.classdesign;

public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		B b = new B();
		b.m1();
		System.out.println(b.n());
		System.out.println(b.var);
		
		A a = new B("Hello");
		a.print();
		
		A objA = new A("Hello");
		B objB = (B) a;
		
		
		

	}

}

class A{
	
	int var = 1;
	public int n() {
		return 3;
	}
	public A(String value) {
		System.out.println("Constractor A");
	}
	public static void print() {
		System.out.println("A");
	}
	public void m1() {
		System.out.println("Class A");
	}
}

class B extends A{
	
	public int n() {
		return super.n() + 10;
	}
	public B() {
		super("Hello");
	}
	public B(String value) {
		super(value);
		// TODO Auto-generated constructor stub
	}
	public static void print() {
		System.out.println("B");
	}
	public void m1() {
		System.out.println("Class B");
	}
	
}